    <form method=get>
    <input type="hidden" name="page" value="users">
    <table>
      <tr>
	<td><a href="?page=users&online=1"><?php echo $session->lang['LI_ONLINE_USERS']; ?></a></td><td>|</td><td><a href="?page=users&online=0"><?php echo $session->lang['LI_ALL_USERS']; ?></a></td>
	<td>|</td>
	<?php if ($session->logged_in) { echo "<td><a href='?page=users&friends=1'>" . $session->lang['LI_FRIENDS'] . "</a></td><td>|</td>"; } ?>
	<td>Search:</td><td><input type="text" id="regionSearch" name="search" autocomplete="off"></td><td><input type="submit" value="Search"></td>
      </tr>
    </table>
    </form>
    <div class="autocomplete" id="regionList" style="display:none"></div>

    <script type="text/javascript">
    var regions = [<?php
      $userList = $osInfo->getFullUserList();

      foreach ($userList as $user) {
        echo "'" . $user["username"] . " " . $user["lastname"] . "',";
      }

    ?>""];
    var typeahead = new Autocompleter.Local('regionSearch', 'regionList', regions, {
                            frequency: 0.1
                        });
    </script>
    <br><br>
    <?php
	if (!is_null($_REQUEST['online']) && $_REQUEST['online']==0) {
  	    $users = $osInfo->getFullUserList();
            echo $session->lang['LI_ALL_USERS'];
	} elseif (!is_null($_REQUEST['friends']) && $_REQUEST['friends']==1 && $session->logged_in) {
  	    $users = $osInfo->getFriendsList($session->uuid);
            echo $session->lang['LI_FRIENDS'];
	} elseif (!is_null($_REQUEST['search'])) {
  	    $users = $osInfo->getFullUserList($_REQUEST['search']);
            echo  $session->lang['GEN_SEARCH'] . ": " . $_REQUEST['search'] . " [<a href='?page=users'>Clear</a>]";
	} else {
            $users = $osInfo->getOnlineList();
            echo $session->lang['LI_ONLINE_USERS'];
	}
    ?><br><br>
    <div id="userList">
    <table width=100% cellspacing=0 class='regionList'>
      <tr class='regionListTR'>
	<td class='regionListTD'><a href='#'><?php echo $session->lang['WHO_USERNAME']; ?></a></td>
	<td class='regionListTD'><a href='#'><?php echo $session->lang['WHO_LOCATION']; ?></a></td>
	<td class='regionListTD' width=150><a href='#'><?php echo $session->lang['WHO_ONLINE_SINCE']; ?></a></td>
      </tr>
    <?php
      if (is_null($users)) {
	echo "<tr><td colspan=3>";
	if (!is_null($_REQUEST['search']) && $_REQUEST['search'] != "")
	  echo $session->lang['WHO_NO_RESULTS'];
	elseif (!is_null($_REQUEST['friends']) && $_REQUEST['friends'] == 1)
	  echo $session->lang['FRIENDS_NO_FRIENDS'];
	else
	  echo $session->lang['WHO_NONE_ONLINE'];
	echo "</td></tr>";
      } else {
        $rC = 0;
        foreach ($users as $user) {
	  if ($user["username"]!="") {
 	    if ($rc++%2==0) 
	      $style=" style='background: #333333;'";
  	    else 
	      $style=" 'background: #000000;'";
	    echo "\t<tr$style><td><a href='?page=profile&user=" . $user["UUID"] . "'>" . $user["username"] . " " . $user["lastname"] .  "</a></td><td>" . $user["regionName"] . "</td>";
	    if ($user["agentOnline"])
		echo "<td>" . date($session->lang['WHO_TIME_FORMAT'],$user["loginTime"]) . "</td></tr>\n";
	    else
		echo "<td>" .$session->lang['GEN_OFFLINE'] . "</td></tr>\n";
	  }
	}

      }
    ?>
    </table>
    </div>
